<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>用户登录</title>
<meta name="viewport" content="width=device-width,intal-scale=1" />
<link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<style>
.container {
	margin: 200px 500px;
	width: 500px;
}

.from-control {
	width: 250px;
	border-radius: 5px;
}
</style>
<script type="text/javascript">
	function check() {
		var uname = document.fm.username;
		var upwd = document.fm.userpwd;
		if (uname.value.length < 5) {
			alert("用户名不能少于5位！");
			return false;
		}
		if (upwd.value.length < 6) {
			alert("密码长度是6~10位");
			return false;
		}
		var pattern = /^(?!^\d)[a-zA-Z0-9_]{5,}$/;
		if (!(uname.value.match(pattern))) {
			alert("用户名只能由字母、数字、下划线组成,不能以数字开头");
			return false;
		}
	}
</script>
</head>

<body>
	<div class="container">
		<div class="row">
			<form name="fm" class="form-horizontal" action="/shopservlet/login"
				method="post" onsubmit="return check()">
				<div>
					
				</div>
				<div class="form-group">
					<label for="inputEmail3" class="col-sm-2 control-label">用户名：</label>
					<div class="col-sm-10">
						<input type="text" name="username" class="from-control"
							id="inputEmai3" placeholder="请输入你的用户名" />
					</div>
				</div>

				<div class="form-group">
					<label for="inputPassword3" class="col-sm-2 control-label">密码:</label>
					<div class="col-sm-10">
						<input type="password" maxlength="10" name="userpwd"
							class="from-control" id="inputPassword3" placeholder="请输入你的密码" />
					</div>
					
				</div>
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="submit" class="btn btn-danger">登录</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>

</html>